<template>
  <div class="publicHeader">
    <div v-if="hasBack" class="back" @click="handleGoBack()">
      <img src="../../assets/images/nav_goback.png" alt="" />
    </div>
    <div class="title">{{ title }}</div>
    <div v-if="hasSearch" class="search" @click="handleGoBack()">
      <img src="../../assets/images/nav_search.png" alt="" />
    </div>
    <div @click="myMonth()" v-if="monthlyReport" class="month">
      我的月报
    </div>
  </div>
</template>

<script>
export default {
  name: "PublicHead",
  props: {
    title: {
      type: String,
      default: "TITLE",
    },
    path: {
      type: String,
      default: "/",
    },
    hasBack: {
      type: Boolean,
      default: true,
    },
    hasSearch: {
      type: Boolean,
      default: false,
    },
    monthlyReport: {
      type: Boolean,
      default: false,
    },
  },
  methods: {
    handleGoBack() {
      this.$router.go(-1);
    },
    myMonth(){
      this.$router.push({path:"/mymonth"})
    }
  },
};
</script>

<style lang="stylus" rel="stylesheet/stylus" scoped>
.publicHeader{
  width 100%
  height 64px
  background-color rgb(25,138,255)
  color:rgb(255,255,255)
  display flex
  justify-content center
  align-items: center;
  font-size 17px
  line-height 1.8rem
  box-sizing border-box
  padding-top 10px
  .title:after{
    content ""
    display inline-block
    vertical-align middle
    height 100%
    }
    .back{
      position absolute
      left 5px
      img{
        width 12px
        height 20px
        margin-left 15px
      }
    }
    .search{
      position absolute
      right  5px
      img{
        width 18px
        height 18px
        margin-right 15px
      }
    }
    .month{
        position absolute
        right  15px
        font-size 13px
    }
}
</style>
